<%@page import="com.db.PeopleDao"%>
<%@page import="com.entity.People"%>
<%@page import="java.sql.Connection"%>
<%@page import="com.util.DbUtil"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  <%
  		Connection conn=DbUtil.getConnection();
  		PeopleDao peopleDao=new PeopleDao();
  		List<People> peoples=peopleDao.queryallpeople();
  		request.setAttribute("list", peoples);
  		DbUtil.close(conn, null);
  
   %>
  <body>
	<div style="text-align: center;">
		<table style="text-align: center;">
			<tr>
				<th>id</th>
				<th>姓名</th>
				<th>性别</th>
				<th>注册时间</th>
			</tr>
			<c:forEach items="${list}" var="p">
				<tr>
					<td>${p.id}</td>
					<td>${p.name}</td>
					<td>${p.sex}</td>
					<td><fmt:formatDate pattern="yyyy-MM-dd" value="${p.time}" /></td>
				</tr>
			</c:forEach>
		</table>
	</div>
  </body>
</html>
